#ifndef LOOP_MESSAGE_QUEUE_H
#define LOOP_MESSAGE_QUEUE_H

#include <stdlib.h>
#include <stdint.h>

struct message {
	size_t sz;
	void * data;
};

struct message_queue;

struct message_queue * mq_create();

void mq_release(struct message_queue *q);

// 0 for success
int mq_pop(struct message_queue *q, struct message *message);
void mq_push(struct message_queue *q, struct message *message);

// return the length of message queue, for debug
int mq_length(struct message_queue *q);
int mq_overload(struct message_queue *q);

#endif
